package com.bwie.controller;

import com.bwie.common.domain.request.UserRequest;
import com.bwie.common.domain.response.UserResponse;
import com.bwie.common.result.Result;
import com.bwie.service.AuthService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author：ShenJiaFeng
 * @Package：com.bwie.controller
 * @Project：zg6_yuekao
 * @name：AuthController
 * @Date：2024/5/17 10:13
 */
@RestController
@RequestMapping("/auth")
public class AuthController {
    @Autowired
    private AuthService authService;

    @PostMapping("/sendCode")
    public Result sendCode(@RequestParam String phone) {
        return authService.sendCode(phone);

    }

    @PostMapping("/login")
    public Result<UserResponse> login(@RequestBody UserRequest userRequest) {
        return authService.login(userRequest.getPhone(), userRequest.getCode());
    }
}
